#ifndef QCRC_H
#define QCRC_H

#include <QObject>
#include <QByteArray>

class QCrc : public QObject
{
    Q_OBJECT
public:
    explicit QCrc(QObject *parent = nullptr);

    uint8_t calculateCRC8(QByteArray &bytes);
    uint16_t calculateCRC16Modbus(QByteArray &bytes);
    uint16_t calculateCRC16XModem(QByteArray &bytes);
    uint32_t calculateCRC32(QByteArray &bytes);

private:
    void InvertUint8(uint8_t *out, uint8_t *in);
    void InvertUint16(uint16_t *out, uint16_t *in);
    void InvertUint32(uint32_t *out, uint32_t *in);

signals:

};

#endif // QCRC_H
